package com.ww.springboot.boot.algorithm.list.ergodic;

import com.ww.springboot.boot.algorithm.sort.BubbleSort;

import java.util.Arrays;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei
 * @since 2021-12-25 16:54
 */
public class MaximumProduct {
    public static void main(String[] args) {
        int[] nums = {-1,-2,-3};
        System.out.println(method(nums));
    }

    public static int method(int[] nums) {
        Arrays.sort(nums);
        int num = nums[nums.length -1] *nums[nums.length -2]*nums[nums.length -3];
        int num2 = nums[nums.length -1] *nums[0]*nums[1];
        return num2>num?num2:num;
    }
}
